/*  1:   */ package com.rinsi.admin.stamp;
/*  2:   */ 
/*  3:   */ import com.rinsi.core.CoreCache;
/*  4:   */ import com.rinsi.core.service.CoreSimpleService;
/*  5:   */ import com.rinsi.util.MapUtil;
/*  6:   */ import java.util.HashMap;
/*  7:   */ import java.util.Map;
/*  8:   */ import org.mybatis.spring.SqlSessionTemplate;
/*  9:   */ import org.springframework.stereotype.Service;
/* 10:   */ 
/* 11:   */ @Service
/* 12:   */ public class StampService
/* 13:   */   extends CoreSimpleService
/* 14:   */ {
/* 15:   */   public void afterIndex(Map<String, Object> model, Map<String, Object> rMap)
/* 16:   */   {
/* 17:17 */     Map<String, Object> params = getParams(model);
/* 18:   */     
/* 19:19 */     Map<String, Object> organ = CoreCache.getCacheMap(MapUtil.getString(params, "UID"), "organ");
/* 20:   */     
/* 21:21 */     params.put("ORGAN_ID", MapUtil.getString(organ, "ORGAN_ID"));
/* 22:   */     
/* 23:23 */     rMap.put("organInfo", getSqlSessionTemplate().selectOne(namespace(getConfig(model)) + ".get", params));
/* 24:   */   }
/* 25:   */   
/* 26:   */   public void updateStamp(String id, byte[] stamp, String stampPassWord)
/* 27:   */   {
/* 28:28 */     Map<String, Object> params = new HashMap();
/* 29:   */     
/* 30:30 */     params.put("ORGAN_ID", id);
/* 31:   */     
/* 32:32 */     params.put("ORGAN_STAMP", stamp);
/* 33:   */     
/* 34:34 */     params.put("ORGAN_STAMP_PASSWORD", stampPassWord);
/* 35:   */     
/* 36:36 */     getSqlSessionTemplate().update("admin/stamp.update", params);
/* 37:   */   }
/* 38:   */   
/* 39:   */   public Map<String, Object> changePWD(Map<String, Object> model)
/* 40:   */   {
/* 41:42 */     Map<String, Object> params = getParams(model);
/* 42:   */     
/* 43:44 */     Map<String, Object> rMap = getRMap();
/* 44:   */     try
/* 45:   */     {
/* 46:48 */       String oldPwd = (String)getSqlSessionTemplate().selectOne("admin/stamp.checkOldPwd", params);
/* 47:50 */       if (oldPwd != null) {
/* 48:50 */         if (!params.get("oldPwd").toString().equals(oldPwd == null ? "" : oldPwd)) {
/* 49:52 */           throw new Exception("旧密码不正确！");
/* 50:   */         }
/* 51:   */       }
/* 52:56 */       params.put("ORGAN_STAMP_PASSWORD", params.get("newPwd1"));
/* 53:   */       
/* 54:58 */       getSqlSessionTemplate().update("admin/stamp.updatePwd", params);
/* 55:   */       
/* 56:60 */       rMap.put("success", Boolean.valueOf(true));
/* 57:   */     }
/* 58:   */     catch (Exception e)
/* 59:   */     {
/* 60:64 */       rMap.put("success", Boolean.valueOf(false));
/* 61:   */       
/* 62:66 */       rMap.put("message", e.getMessage());
/* 63:   */       
/* 64:68 */       e.printStackTrace();
/* 65:   */     }
/* 66:72 */     return rMap;
/* 67:   */   }
/* 68:   */ }


/* Location:           D:\Users\Desktop\shanxi\项目\sxazmis\WEB-INF\classes\
 * Qualified Name:     com.rinsi.admin.stamp.StampService
 * JD-Core Version:    0.7.0.1
 */